﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.NeighborUI {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import org.aswing.*;
    import Classes.*;
    import flash.filters.*;
    import Display.*;
    import flash.text.*;
    import Display.aswingui.*;

    public class FriendHelpDialogView extends GenericDialogView {

        public static const FAKE_FRIEND_COMMODITY_AMOUNT:int = 200;

        protected var m_textShadow:DropShadowFilter;
        protected var m_amount:int;
        protected var m_amountField:JTextField;
        protected var m_friend:Player;
        protected var m_pic:Loader;
        private var m_friendFrameAP:AssetPane;
        private var m_AcceptText:String;
        protected var helpFriendTitlePanel:JPanel;

        public function FriendHelpDialogView(_arg1:Dictionary, _arg2:String="", _arg3:String="", _arg4:int=0, _arg5:String="IdleGoHelpOutNow_button", _arg6:Function=null){
            this.m_AcceptText = _arg5;
            m_message = _arg2;
            m_titleString = _arg3;
            super(_arg1, _arg2, _arg3, _arg4, _arg6);
        }
        public function get friend():Player{
            return (this.m_friend);
        }
        override protected function init():void{
            var _local1:String;
            this.m_textShadow = new DropShadowFilter(1, 90, 5602453, 1, 0, 0);
            m_acceptTextName = ZLoc.t("Dialogs", this.m_AcceptText);
            m_cancelTextName = "";
            this.m_friend = m_assetDict["friend"];
            if (((this.m_friend) && (this.m_friend.snUser))){
                _local1 = this.m_friend.snUser.picture;
                if (_local1){
                    this.m_pic = LoadingManager.load(_local1, this.fillFriendFrame, LoadingManager.PRIORITY_LOW);
                };
            };
            if (this.m_pic == null){
                this.m_pic = new EmbeddedArt.hud_no_profile_pic();
                this.m_pic.width = 48;
                this.m_pic.height = 48;
            };
            m_bgAsset = (new (m_assetDict["dialogBG"])() as DisplayObject);
            makeBackground();
            this.makeCenterPanel();
            ASwingHelper.prepare(this);
        }
        private function fillFriendFrame(_arg1:Event):void{
            var _local2:Sprite = new Sprite();
            var _local3:DisplayObject = this.m_pic.content;
            _local2.addChild(_local3);
            this.m_friendFrameAP.setAsset(_local2);
            ASwingHelper.prepare(this);
        }
        private function makeInfo():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT);
            this.m_friendFrameAP = new AssetPane(new Sprite());
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            _local2.append(ASwingHelper.verticalStrut(23));
            _local2.append(this.m_friendFrameAP);
            _local2.append(ASwingHelper.horizontalStrut(0));
            ASwingHelper.prepare(_local2);
            _local1.appendAll(ASwingHelper.horizontalStrut(80), _local2);
            return (_local1);
        }
        override protected function createTitlePanel():JPanel{
            var _local2:String;
            var _local1:JPanel = this.makeInfo();
            _local2 = ZLoc.t("Dialogs", (m_titleString + "_title"));
            var _local3:JTextField = ASwingHelper.makeTextField((_local2 + " "), EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 15, EmbeddedArt.blueTextColor);
            var _local4:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            _local4.appendAll(ASwingHelper.verticalStrut(50), _local3);
            ASwingHelper.prepare(_local4);
            this.helpFriendTitlePanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT);
            this.helpFriendTitlePanel.append(_local1);
            this.helpFriendTitlePanel.appendAll(ASwingHelper.horizontalStrut(20), _local4);
            ASwingHelper.prepare(this.helpFriendTitlePanel);
            return (this.helpFriendTitlePanel);
        }
        override protected function createCloseButtonPanel():JPanel{
            var _local1:JPanel = new JPanel(ASwingHelper.softBoxLayoutVertical);
            var _local2:JButton = ASwingHelper.makeMarketCloseButton();
            _local2.addEventListener(MouseEvent.CLICK, onCancelX, false, 0, true);
            _local1.append(_local2);
            ASwingHelper.setEasyBorder(_local2, 9, 0, 0, 16);
            return (_local1);
        }
        override protected function makeCenterPanel():void{
            var _local1:JPanel = createInteriorHolder();
            _local1.setPreferredWidth(m_bgAsset.width);
            _local1.setMinimumWidth(m_bgAsset.width);
            _local1.setMaximumWidth(m_bgAsset.width);
            _local1.setPreferredHeight(m_bgAsset.height);
            _local1.setMinimumHeight(m_bgAsset.height);
            _local1.setMaximumHeight(m_bgAsset.height);
            this.append(_local1);
            ASwingHelper.prepare(this);
        }
        override protected function createTextComponent(_arg1:Number):Component{
            var _local2:Component;
            var _local3:int = ((_arg1 - character_width) - 10);
            var _local4:JPanel = ASwingHelper.horizontalStrut(_local3);
            var _local5:String = ZLoc.t("Dialogs", m_message);
            var _local6:Component = ASwingHelper.makeMultilineText(m_message, _local3, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.CENTER, 15, EmbeddedArt.brownTextColor);
            var _local7:Number = 75;
            var _local8:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT);
            _local8.appendAll(ASwingHelper.horizontalStrut((character_width + 5)), _local6);
            ASwingHelper.prepare(_local8);
            var _local9:Number = ((_local7 - _local6.getHeight()) / 2);
            var _local10:Container = ASwingHelper.makeSoftBoxJPanelVertical();
            _local10.append(ASwingHelper.verticalStrut(_local9));
            _local10.append(_local8);
            _local10.append(ASwingHelper.verticalStrut(_local9));
            _local2 = _local10;
            return (_local2);
        }
        override protected function createButtonPanel():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.LEFT);
            var _local2:Number = TextFieldUtil.getLocaleFontSize(22, 18, null);
            var _local3:CustomButton = new CustomButton(m_acceptTextName, null, "GreenButtonUI");
            _local3.setFont(ASwingHelper.makeFont(EmbeddedArt.TITLE_FONT, _local2));
            _local3.addActionListener(onAccept, 0, true);
            _local1.appendAll(ASwingHelper.horizontalStrut((character_width + 42)), _local3);
            var _local4:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            _local4.append(ASwingHelper.verticalStrut(20));
            _local4.append(_local1);
            return (_local4);
        }

    }
}//package Display.NeighborUI 
